package com.localjoycommunity.cpdj.project.system.controller;


import com.localjoycommunity.cpdj.common.R;
import com.localjoycommunity.cpdj.common.utils.ValidateUtil;
import com.localjoycommunity.cpdj.project.system.service.ISmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Function:
 * @Author: aqie
 * @Date: 2019/5/10 10:21
 */
@RestController
@RequestMapping("app/sms")
public class SmsController {
    @Autowired
    private ISmsService smsService;

    @GetMapping("send")
    public R sendSms(@RequestParam(value = "phone") String phone){
        if (!ValidateUtil.checkTelephone(phone)){
            return R.error("手机号格式错误");
        }
        return smsService.sendSms(phone);
    }
}
